home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
comm2
/
termsorc.lha
/
Extras
/
Source
/
gtlayout-source.lha
/
LT_InitExit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-25
|
3KB
|
162 lines
/* GadTools layout toolkit
**
** Copyright © 1993-1995 by Olaf `Olsen' Barthel
** Freely distributable.
*/
#include "gtlayout_global.h"
BOOL __saveds __asm
LT_Init()
{
#ifndef _GTLAYOUT_GLOBAL_H
if(SysBase)
return(TRUE);
else
#endif
{
SysBase = *(struct ExecBase **)4;
if(SysBase -> LibNode . lib_Version < 37)
{
#ifndef _GTLAYOUT_GLOBAL_H
SysBase = NULL;
#endif
return(FALSE);
}
else
{
V39 = (SysBase -> LibNode . lib_Version >= 39);
V40 = (SysBase -> LibNode . lib_Version >= 40);
IntuitionBase = OpenLibrary("intuition.library",37);
GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",37);
UtilityBase = OpenLibrary("utility.library",37);
GadToolsBase = OpenLibrary("gadtools.library",37);
KeymapBase = OpenLibrary("keymap.library",37);
if(LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library",38))
LTP_Locale = OpenLocale(NULL);
if(IntuitionBase && GfxBase && UtilityBase && GadToolsBase && KeymapBase)
{
if(LTP_ImageClass = MakeClass(NULL,IMAGECLASS,NULL,sizeof(ImageInfo),0))
{
LTP_ImageClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)LTP_ImageDispatch;
#ifdef DO_LEVEL_KIND
if(LTP_LevelClass = MakeClass(NULL,IMAGECLASS,NULL,sizeof(LevelImageInfo),0))
{
LTP_LevelClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)LTP_LevelClassDispatcher;
#else
{
#endif /* DO_LEVEL_KIND */
#if defined(DO_POPUP_KIND) && defined(DO_BOOPSI_KIND)
if(LTP_PopupClass = MakeClass(NULL,GADGETCLASS,NULL,sizeof(PopInfo),0))
{
LTP_PopupClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)LTP_PopupClassDispatcher;
#else
{
#endif // DO_POPUP_KIND
#if defined(DO_TAB_KIND) && defined(DO_BOOPSI_KIND)
if(LTP_TabClass = MakeClass(NULL,GADGETCLASS,NULL,sizeof(TabInfo),0))
{
LTP_TabClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)LTP_TabClassDispatcher;
#else
{
#endif // DO_TAB_KIND
#ifdef DO_PICKSHORTCUTS
InitSemaphore(<P_KeySemaphore);
#endif /* DO_PICKSHORTCUTS */
InitSemaphore(<P_LockSemaphore);
NewList((struct List *)<P_LockList);
NewList((struct List *)<P_EmptyList);
return(TRUE);
}
}
}
}
}
LT_Exit();
return(FALSE);
}
}
}
/*****************************************************************************/
VOID __saveds __asm
LT_Exit()
{
#ifndef _GTLAYOUT_GLOBAL_H
if(SysBase)
#endif
{
#ifdef DO_LEVEL_KIND
if(LTP_LevelClass)
{
FreeClass(LTP_LevelClass);
LTP_LevelClass = NULL;
}
#endif /* DO_LEVEL_KIND */
#if defined(DO_POPUP_KIND) && defined(DO_BOOPSI_KIND)
if(LTP_PopupClass)
{
FreeClass(LTP_PopupClass);
LTP_PopupClass = NULL;
}
#endif // DO_POPUP_KIND
#if defined(DO_TAB_KIND) && defined(DO_BOOPSI_KIND)
if(LTP_TabClass)
{
FreeClass(LTP_TabClass);
LTP_TabClass = NULL;
}
#endif // DO_TAB_KIND
if(LTP_ImageClass)
{
FreeClass(LTP_ImageClass);
LTP_ImageClass = NULL;
}
if(LTP_Locale)
{
CloseLocale(LTP_Locale);
LTP_Locale = NULL;
}
CloseLibrary(LocaleBase);
LocaleBase = NULL;
CloseLibrary(KeymapBase);
KeymapBase = NULL;
CloseLibrary(GadToolsBase);
GadToolsBase = NULL;
CloseLibrary(UtilityBase);
UtilityBase = NULL;
CloseLibrary(GfxBase);
GfxBase = NULL;
CloseLibrary(IntuitionBase);
IntuitionBase = NULL;
#ifndef _GTLAYOUT_GLOBAL_H
SysBase = NULL;
#endif
}
}